<template>
    <div style="width:100%;height:100%">
        <div style="width: 100%">
            <span  class="font-style" >最新通知</span>
        </div>
        <el-divider></el-divider>
        <div style="height: 100%;width: 100%">
            <el-row>
                <el-col :span="12" v-for="inform in informData" :key="inform.id" style="padding :5px 5px 10px 15px;border-bottom: 1px dashed #e2e2e2;">
                    <div style="width: 100%;height: 25px">
                        <el-link type="info" style="color: #606266;font-size: 16px;" @click="toInformView(inform.id)" >{{inform.title}}</el-link>
                    </div>
                    <el-row style="width: 100%;height: 25px;margin:  5px 0">
                        <el-col :span="9" style="height: 100%;">
                            <i class="el-icon-s-custom" style="color: rgba(66, 217, 125, 0.74)"></i>
                            <div style="display: inline-block">
                                <span class="marginLR" style="font-size: 15px">
                                    {{inform.userNickname}}
                                </span>
                            </div>
                        </el-col>
                        <el-col :span="8">
                            <!--                            点击数-->
                            <i class="el-icon-view iconStyle" ></i>
                            <span class="marginLR">{{inform.hitsNum}}</span>
                        </el-col>
                        <el-col :span="7">
                            <!--                            更新时间-->
                            <i class="el-icon-time iconStyle" ></i>
                            <span class="marginL">{{inform.updateTime | dateFormatFun(1)}}</span>
                        </el-col>

                    </el-row>

                </el-col>

            </el-row>
        </div>

    </div>
</template>

<script>
    export default {
        name: "InformList",
        data(){
            return{
                informData:[],      //所有的通知信息
                
            }
        },
        created() {
            this.queryAllInforms(8);
        },
        methods:{
            //加载通知数据
            queryAllInforms(num){
                this.request.get("/index/inform/queryAllInforms",{
                    params:{
                        queryTitleLike: this.queryTitleLike,
                        pageIndex: this.pageIndex,
                        pageSize: this.pageSize,
                        orderByCreateTime: "createTime_desc",
                    }
                }).then(res=>{
                    if (res.code=="200"){
                        num=(res.data.informs.length>8)?8:res.data.informs.length;
                        for (let i=0;i<num;i++){
                            this.informData.push(res.data.informs[i]);
                        }
                    }else if(res.code=="301"){
                        this.$message({
                            message: res.data,
                            type: 'warning'
                        });
                    }
                })
            },
            //跳转到通知界面
            toInformView(informId){
                this.$router.push({
                    path:"/frontFramework/informManage",
                    query:{
                        id:informId,
                    }});
            },

        }
    }
</script>

<style scoped>

</style>